//
//  TrimFromTo4.swift
//  SwiftUIAnimation
//
//  Created by 李煜 on 2024/8/21.
//

import SwiftUI

struct TrimFromTo4: View {
  @State private var trimAmount: CGFloat = 0.0

  var body: some View {
    Circle()
      .trim(from: 0, to: trimAmount) // 裁剪圆形
      .stroke(Color.blue, lineWidth: 10) // 设置边框颜色和宽度
      .frame(width: 200, height: 200)
      .onAppear {
        // 动画效果，逐渐显示整个圆形
        withAnimation(.linear(duration: 2.0)) {
          trimAmount = 1.0 // 将裁剪比例设置为1.0，显示整个圆形
        }
      }
  }
}

#Preview {
  TrimFromTo4()
}
